package com.hengpeng.itfinbase.message.partner;

import com.hengpeng.itfinbase.message.RequestMessage;
import com.hengpeng.itfinbase.message.ResponseMessage;

public enum PartnerTransType {
    /**
     * 平台账户查询
     */
    QueryAccts("QueryAccts", QueryAcctsRequestMsg.class, QueryAcctsResponseMsg.class, "平台账户查询"),

    /**
     * 用户开户
     */
    UserRegister("UserRegister", OpenRequestMsg.class, OpenResponseMsg.class, "用户开户"),

    /**
     * 企业开户
     */
    CorpRegister("CorpRegister", CorpOpenRequestMsg.class, CorpOpenResponseMsg.class, "企业开户"),
    /**
     * 企业开户状态查询
     */
    CorpRegisterQuery("CorpRegisterQuery", CorpRegisterQueryRequest.class, CorpRegisterQueryResponse.class, "企业开户"),

    /**
     * 绑定银行卡
     */
    UserBindCard("UserBindCard", PayRequestMsg.class, PayResponseMsg.class, "绑卡"),
    /**
     * 充值
     */
    NetSave("NetSave", PayRequestMsg.class, PayResponseMsg.class, "充值"),
    /**
     * 取现
     */
    Cash("Cash", PayRequestMsg.class, PayResponseMsg.class, "取现"),
    /**
     * 账户资料修改
     */
    AcctModify("AcctModify", ModifyRequest.class, ModifyResponse.class, "资料修改"),
    /**
     * 转账（商户用）
     */
    Transfer("Transfer", TransferRequest.class, TransferResponse.class, "转账"),

    /**
     * 借款人正常还款
     */
    BatchRepayment("BatchRepayment", RepaymentRequestMsg.class, RepaymentResponseMsg.class, "借款人正常还款"),

    /**
     * 余额查询(后台方式)
     */
    QueryBalanceBg("QueryBalanceBg", QueryBalanceRequest.class, QueryBalanceResponse.class, "余额查询(后台方式)"),

    /**
     * 标的信息录入
     */
    AddBidInfo("AddBidInfo", AddBidInfoRequest.class, AddBidInfoResponse.class, "标的信息录入"),

    /**
     * 标的放款
     */
    Loans("Loans", LoansRequest.class, LoansResponse.class, "标的放款"),

    /**
     * 标的撤销
     */
    TenderCancle("TenderCancle", TenderCancleRequest.class, TenderCancleResponse.class, "标的撤销"),

    /**
     * 资金解冻
     */
    UsrUnFreeze("UsrUnFreeze", UsrUnFreezeRequest.class, UsrUnFreezeResponse.class, "资金解冻"),

    /**
     * 还款,还垫资操作
     */
    Repayment("Repayment", RepaymentRequestMsg.class, RepaymentResponseMsg.class, "还款,还垫资操作"),
    /**
     * 主动投标
     */
    InitiativeTender("InitiativeTender", InvestInfoRequestMsg.class, InvestInfoResponseMsg.class, "主动投标"),
    /**
     * 交易状态查询
     */
    QueryTransStat("QueryTransStat", RequestMessage.class, ResponseMessage.class, "交易状态查询"),
    /**
     * 交易明细查询
     */
    QueryTransDetail("QueryTransDetail", RequestMessage.class, ResponseMessage.class, "交易明细查询"),
    /**
     * 银行卡查询接口
     */
    QueryCardInfo("QueryCardInfo", RequestMessage.class, ResponseMessage.class, "银行卡查询接口"),
    /**
     * 放款还款对账接口
     */
    Reconciliation("Reconciliation", RequestMessage.class, ResponseMessage.class, "放款还款对账接口"),

    /**
     * 商户扣款对账
     */
    TrfReconciliation("TrfReconciliation", RequestMessage.class, ResponseMessage.class, "商户扣款对账接口"),

    /**
     * 充值对账接口
     */
    SaveReconciliation("SaveReconciliation", RequestMessage.class, ResponseMessage.class, "充值对账接口"),
    /**
     * 取现对账接口
     */
    CashReconciliation("CashReconciliation", RequestMessage.class, ResponseMessage.class, "取现对账接口"),
    /**
     * 债权转让接口
     */
    CreditAssign("CreditAssign", RequestMessage.class, ResponseMessage.class, "债权转让接口");

    private String type;

    private Class<?> requestType;

    private Class<?> responseType;

    private String text;

    PartnerTransType(String type, Class<? extends RequestMessage> request, Class<? extends ResponseMessage> response,
            String text) {
        this.type = type;
        this.responseType = response;
        this.requestType = request;
        this.text = text;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Class<?> getRequestType() {
        return requestType;
    }

    public void setRequestType(Class<?> requestType) {
        this.requestType = requestType;
    }

    public Class<?> getResponseType() {
        return responseType;
    }

    public void setResponseType(Class<?> responseType) {
        this.responseType = responseType;
    }

    public static PartnerTransType getPartnerTransType(String type) {
        PartnerTransType[] values = PartnerTransType.values();
        for (PartnerTransType en : values) {
            if (en.getType().equals(type)) {
                return en;
            }
        }
        return null;
    }
}
